//
//  Ser_CommentTableViewCell.m
//  CarFace
//
//  Created by dlios on 15-4-4.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "Ser_CommentTableViewCell.h"

@implementation Ser_CommentTableViewCell



- (void)dealloc
{
    [_headImg release];
    [_name release];
    [_grade release];
    [_levelGrade release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headImg = [[UIImageView alloc]init];
//        self.headImg.backgroundColor = [UIColor purpleColor];
        [self.contentView addSubview:self.headImg];
        [_headImg release];
        
        self.name = [[UILabel alloc]init];
//        self.name.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.name];
        [_name release];
        
        self.grade = [[UILabel alloc]init];
//        self.grade.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.grade];
        [_grade release];
        
        
        self.levelGrade = [[UILabel alloc]init];
//        self.levelGrade.backgroundColor = [UIColor magentaColor];
        [self.contentView addSubview:self.levelGrade];
        [_levelGrade release];
        
        
    }
    return self;
    
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat W = self.contentView.frame.size.width;
    CGFloat H = self.contentView.frame.size.height;
    
    //设置各个元素的frame
    self.headImg.frame = CGRectMake(10, 0, W/9, H-5);
    self.name.frame = CGRectMake(10+W/9+5,0, (W-10-W/9-35)/3, H-10);
    self.grade.frame = CGRectMake(10+W/9+5+10+(W-10-W/9-35)/3, 0, (W-10-W/9-35)/3, H-10);
    self.levelGrade.frame = CGRectMake(10+W/9+5+10+10+(W-10-W/9-35)/3*2, 0,(W-10-W/9-35)/3, H-10);

    //赋值
    self.name.text = self.info.name;
    self.grade.text = [NSString stringWithFormat:@"%@分",self.info.grade];
    self.levelGrade.text = [NSString stringWithFormat:@"%@分",self.info.levelgrade];
 
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
